package com.huazi.statistics.controller;


import com.huazi.commonutils.CommentResult;
import com.huazi.statistics.service.DailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author huazi
 * @since 2021-04-01
 */
@RestController
@CrossOrigin
@EnableDiscoveryClient
@EnableFeignClients
@RequestMapping("/statistics/daily")
public class DailyController {
    @Autowired
    DailyService dailyService;
    //获取某天注册人数
    @GetMapping("registerCount/{day}")
    public CommentResult registerCount(@PathVariable String day){
        dailyService.registerCount(day);
        return CommentResult.getOK();
    }
    //图表显示
    @GetMapping("showData/{type}/{begin}/{end}")
    public CommentResult showData(@PathVariable String type,@PathVariable String begin ,@PathVariable String end){
        Map<String,Object> map=dailyService.getSearchData(type,begin,end);
        return CommentResult.getOK().data("data",map);
    }
}

